﻿using System;
using DevelopTool.Forms.BaseForms;
using Sunny.UI;

namespace DevelopTool.Forms.TextProcessForms
{
    /// <summary>
    /// 文本转大小写
    /// </summary>
    public partial class ConvertToUpper_LowerForm : BaseUIPage
    {

        public ConvertToUpper_LowerForm()
        {
            InitializeComponent();
        }

        private void ConvertToUpper_LowerForm_Load(object sender, EventArgs e)
        {

        }

        private void btnUpper_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.codeEditorIn.ContentText))
            {
                this.ShowWarningNotifier("请输入需要转换的文本");
                return;
            }
            try
            {
                this.codeEditorOut.ContentText = this.codeEditorIn.ContentText.ToUpper();
                this.ShowWarningTip(this.btnUpper, "已转换");
            }
            catch (Exception ex)
            {
                this.ShowErrorDialog(ex.Message);
            }
        }

        private void btnLower_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.codeEditorIn.ContentText))
            {
                this.ShowWarningNotifier("请输入需要转换的文本");
                return;
            }
            try
            {
                this.codeEditorOut.ContentText = this.codeEditorIn.ContentText.ToLower();
                this.ShowWarningTip(this.btnLower, "已转换");
            }
            catch (Exception ex)
            {
                this.ShowErrorDialog(ex.Message);
            }
        }
    }
}
